package com.lujianfei.shortcut

import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import androidx.annotation.RequiresApi
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    @RequiresApi(Build.VERSION_CODES.N_MR1)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        bt_test_add_shortcut.setOnClickListener {
            ShortCutUtils.addShortCut(this@MainActivity, shortLabel = "AddShortCut", id = "id", packageName = "com.android.settings")
        }
        bt_test_check_shortcut.setOnClickListener {
            Toast.makeText(this@MainActivity, "${ShortCutUtils.isShortCutExist(this@MainActivity, id = "id")}", Toast.LENGTH_SHORT).show()
        }
    }
}
